[20250131] BOJ / G1 / 부분수열의 합 2 / 김민진 #1865
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
부분수열의 합 2
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
주어진 수열의 부분수열의 합으로
S를 만들 수 있는 경우의 수는?🔍 풀이 방법
N >= 40이라 브루트포스는 시간초과→ 왼쪽 절반과 오른쪽 절반을 나누어 부분수열의 합을 맵에다 저장
왼쪽 배열의 임의의 값 x * 오른쪽 배열의 S - x를 반복문을 이용해 모두 더해주기→ 최대
2^20 * 2^20가지의 경우가 나올 수 있으므로long으로 구해야함⏳ 회고
음 골1치고 쉬운 것 같기도..
유달리 이분탐색 태그에서 다르게 풀 수 있는 경우가 많은듯?